{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_excel('dataset.xls')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对数据分析时，针对不同的车类计算异常的百分比，按照百分比来初步统计。\n",
    "对于数值型数据，按照不同的标签，画出plot图，来统计变换范围。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "type_dummies = pd.get_dummies(df[u'销售类型'],prefix= 'type')\n",
    "model_dummies = pd.get_dummies(df[u'销售模式'],prefix= 'model')\n",
    "result_dummies = pd.get_dummies(df[u'输出'],prefix = 'result')\n",
    "df = pd.concat([df,type_dummies,model_dummies,result_dummies],axis=1)\n",
    "#df['输出']=df['输出'].replace('正常',1)\n",
    "#df['输出']=df['输出'].replace('异常',0)\n",
    "#for m,n in enumerate(set(df['销售类型'])):\n",
    "#    df['销售类型'] = df['销售类型'].replace(n, m+1)\n",
    "#for m,n in enumerate(set(df['销售模式'])):\n",
    "#    df['销售模式'] = df['销售模式'].replace(n, m+1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     纳税人编号   销售类型        销售模式  汽车销售平均毛利    维修毛利  企业维修收入占销售收入比重   增值税税负  \\\n",
      "0        1   国产轿车         4S店    0.0635  0.3241         0.0879  0.0084   \n",
      "1        2   国产轿车         4S店    0.0520  0.2577         0.1394  0.0298   \n",
      "2        3   国产轿车         4S店    0.0173  0.1965         0.1025  0.0067   \n",
      "3        4   国产轿车       一级代理商    0.0501  0.0000         0.0000  0.0000   \n",
      "4        5   进口轿车         4S店    0.0564  0.0034         0.0066  0.0017   \n",
      "5        6   进口轿车         4S店    0.0484  0.6814         0.0064  0.0031   \n",
      "6        7   进口轿车         4S店    0.0520  0.3868         0.0348  0.0054   \n",
      "7        8    大客车       一级代理商   -1.0646  0.0000         0.0000  0.0770   \n",
      "8        9   国产轿车  二级及二级以下代理商    0.0341 -1.2062         0.0025  0.0070   \n",
      "9       10   国产轿车  二级及二级以下代理商    0.0312  0.2364         0.0406  0.0081   \n",
      "10      11   国产轿车         4S店    0.0489  0.4763         0.0851  0.0000   \n",
      "11      12   国产轿车         4S店    0.0638  0.4570         0.1521  0.0175   \n",
      "12      13   国产轿车         4S店    0.0250  0.5117         0.0332  0.0107   \n",
      "13      14   国产轿车         4S店    0.0354  0.3237         0.0505  0.0000   \n",
      "14      15   国产轿车         4S店    0.0204  0.4578         0.0568  0.0000   \n",
      "15      16   国产轿车         4S店    0.0578  0.4547         0.0677  0.0150   \n",
      "16      17   国产轿车         4S店    0.0614  0.5868         0.0080  0.0030   \n",
      "17      18   国产轿车         4S店    0.0546  0.4269         0.0420  0.0055   \n",
      "18      19   国产轿车         4S店    0.0323  0.4132         0.0352  0.0047   \n",
      "19      20   国产轿车         4S店    0.0587  0.3284         0.0212  0.0000   \n",
      "20      21   国产轿车         4S店    0.0440  0.4071         0.0181  0.0079   \n",
      "21      22   国产轿车         4S店    0.0555  0.0000         0.0000  0.0056   \n",
      "22      23   国产轿车          其它    0.0060  0.0000         0.0000  0.0000   \n",
      "23      24   国产轿车          其它    0.0185  0.0000         0.0000  0.0040   \n",
      "24      25    大客车       一级代理商    0.0115  0.0000         0.0000  0.0028   \n",
      "25      26    大客车       一级代理商    0.0091  0.0000         0.0000  0.0028   \n",
      "26      27    大客车       一级代理商    0.0115  0.0000         0.0000  0.0027   \n",
      "27      28     其它         4S店   -0.0047  0.2811         0.1362  0.0089   \n",
      "28      29     其它         4S店    0.0066  0.2784         0.1301  0.0064   \n",
      "29      30     其它         4S店    0.0073  0.2705         0.1473  0.0073   \n",
      "..     ...    ...         ...       ...     ...            ...     ...   \n",
      "94      95   国产轿车         4S店    0.0299  0.2824         0.0747  0.0047   \n",
      "95      96    大客车          其它    0.0000  0.0000         0.0000  0.0107   \n",
      "96      97  卡车及轻卡  二级及二级以下代理商    0.0235  0.0000         0.0000  0.0026   \n",
      "97      98   国产轿车         4S店    0.0469  0.4438         0.0921  0.0064   \n",
      "98      99   国产轿车         4S店    0.0404  0.2879         0.1408  0.0113   \n",
      "99     100   国产轿车         4S店    0.0238  0.0000         0.0000  0.0000   \n",
      "100    101   国产轿车         4S店    0.0212  0.0000         0.0000  0.0000   \n",
      "101    102    大客车  二级及二级以下代理商    0.0109  0.0000         0.0000  0.0030   \n",
      "102    103   国产轿车       一级代理商    0.0301  0.1325         0.0760  0.0053   \n",
      "103    104   国产轿车         4S店    0.0120  0.4424         0.1393  0.0088   \n",
      "104    105   进口轿车         4S店    0.0000  0.0000         0.0000  0.0000   \n",
      "105    106  微型面包车       一级代理商    0.0000  0.0000         0.0000  0.0000   \n",
      "106    107    工程车       一级代理商    0.0172  0.2492         0.0340  0.0015   \n",
      "107    108     其它         4S店    0.0539  0.2598         0.0463  0.0096   \n",
      "108    109   国产轿车         4S店    0.0471  0.4431         0.0778  0.0086   \n",
      "109    110   国产轿车  二级及二级以下代理商    0.0129  0.0000         0.0000  0.0073   \n",
      "110    111   国产轿车       一级代理商    0.0283  0.0000         0.0000  0.0017   \n",
      "111    112    大客车  二级及二级以下代理商    0.0000  0.0000         0.0000  0.0000   \n",
      "112    113   国产轿车  二级及二级以下代理商    0.0000  0.0000         0.0000  0.0000   \n",
      "113    114   进口轿车         4S店    0.0494  0.0000         0.0000  0.0044   \n",
      "114    115   国产轿车       一级代理商    0.0494  0.0815         0.0000  0.0000   \n",
      "115    116  微型面包车         4S店    0.0000  0.0000         0.0000  0.0000   \n",
      "116    117   国产轿车         4S店    0.0000  0.0000         0.0000  0.0263   \n",
      "117    118   国产轿车       一级代理商    0.0640  0.0000         0.0000  0.0050   \n",
      "118    119   商用货车       一级代理商    0.0713  0.0000         0.0000  0.0080   \n",
      "119    120   国产轿车         4S店    0.0000  0.0000         0.0000  0.0000   \n",
      "120    121  卡车及轻卡       一级代理商    0.0196  0.0000         0.0000  0.0015   \n",
      "121    122  卡车及轻卡          其它    0.0000  0.0000         0.0000  0.0000   \n",
      "122    123   国产轿车         4S店    0.0458  0.2942         0.0665  0.0108   \n",
      "123    124   国产轿车         4S店    0.0135  0.4799         0.0094  0.0041   \n",
      "\n",
      "       存货周转率  成本费用利润率  整体理论税负    ...      type_工程车  type_微型面包车  type_进口轿车  \\\n",
      "0     8.5241   0.0018  0.0166    ...             0           0          0   \n",
      "1     5.2782  -0.0013  0.0032    ...             0           0          0   \n",
      "2    19.8356   0.0014  0.0080    ...             0           0          0   \n",
      "3     1.0673  -0.3596 -0.1673    ...             0           0          0   \n",
      "4    12.8470  -0.0014  0.0123    ...             0           0          1   \n",
      "5    15.2445   0.0012  0.0063    ...             0           0          1   \n",
      "6    16.8715   0.0054  0.0103    ...             0           0          1   \n",
      "7     2.0000  -0.2905 -0.1810    ...             0           0          0   \n",
      "8     9.6142  -0.1295  0.0413    ...             0           0          0   \n",
      "9    21.3944   0.0092  0.0112    ...             0           0          0   \n",
      "10   10.9974   0.2156  0.0136    ...             0           0          0   \n",
      "11    3.5134   0.1022  0.0239    ...             0           0          0   \n",
      "12   18.3744   0.5642  0.0071    ...             0           0          0   \n",
      "13    8.1862  -0.0001  0.0002    ...             0           0          0   \n",
      "14    9.8039   0.0002  0.0046    ...             0           0          0   \n",
      "15   11.4036   0.0014  0.0118    ...             0           0          0   \n",
      "16   11.9058   0.0000  0.0184    ...             0           0          0   \n",
      "17    6.4187   1.0940 -0.0044    ...             0           0          0   \n",
      "18   11.0045   1.2121  0.0188    ...             0           0          0   \n",
      "19   21.3226   1.5312  0.0120    ...             0           0          0   \n",
      "20   18.4517   0.9134  0.0258    ...             0           0          0   \n",
      "21   22.4516   0.9252  0.0087    ...             0           0          0   \n",
      "22    0.0000   0.0060  0.0009    ...             0           0          0   \n",
      "23    0.0000   0.0185  0.0040    ...             0           0          0   \n",
      "24   47.6128   0.0004  0.0042    ...             0           0          0   \n",
      "25   40.0488   0.0004 -0.0012    ...             0           0          0   \n",
      "26   48.3830   0.0003  0.0053    ...             0           0          0   \n",
      "27   12.0948  -0.0074 -0.0081    ...             0           0          0   \n",
      "28   26.9379  -0.0046  0.0085    ...             0           0          0   \n",
      "29   20.6979  -0.0117  0.0091    ...             0           0          0   \n",
      "..       ...      ...     ...    ...           ...         ...        ...   \n",
      "94    8.6046   0.0201 -0.0005    ...             0           0          0   \n",
      "95   21.2676   0.2904  0.0123    ...             0           0          0   \n",
      "96   12.0229  -0.0025  0.0200    ...             0           0          0   \n",
      "97   19.8277   0.0182  0.0106    ...             0           0          0   \n",
      "98    5.8424  -0.0153  0.0178    ...             0           0          0   \n",
      "99    8.4731  -0.0129  0.0024    ...             0           0          0   \n",
      "100   0.0000  -0.0106  0.0000    ...             0           0          0   \n",
      "101   0.0000   0.0041  0.0030    ...             0           0          0   \n",
      "102   7.3614   0.0005  0.0129    ...             0           0          0   \n",
      "103   9.7004   1.0270  0.0120    ...             0           0          0   \n",
      "104   3.3748  -0.1933  0.0670    ...             0           0          1   \n",
      "105   0.0000   0.0000  0.0000    ...             0           1          0   \n",
      "106  11.5771   0.0049  0.0048    ...             1           0          0   \n",
      "107  26.1375   0.1030  0.0120    ...             0           0          0   \n",
      "108  21.3278   0.0027  0.0115    ...             0           0          0   \n",
      "109   0.0000  -0.0036  0.0073    ...             0           0          0   \n",
      "110  12.4257   0.0007  0.0049    ...             0           0          0   \n",
      "111   0.0000   0.0000  0.0000    ...             0           0          0   \n",
      "112   0.0000   0.0000  0.0000    ...             0           0          0   \n",
      "113   6.4030   0.0328 -0.0229    ...             0           0          1   \n",
      "114   0.0182   6.9651 -0.0050    ...             0           0          0   \n",
      "115   0.0000   0.0000  0.0000    ...             0           1          0   \n",
      "116   3.3587  -0.0772  0.1078    ...             0           0          0   \n",
      "117  19.0593   0.0394  0.0008    ...             0           0          0   \n",
      "118  32.2678   0.0036  0.0106    ...             0           0          0   \n",
      "119   0.0000   0.0000  0.0000    ...             0           0          0   \n",
      "120   0.0000   0.0020  0.0176    ...             0           0          0   \n",
      "121   6.1714   0.0000  0.0303    ...             0           0          0   \n",
      "122  11.8587   0.0014  0.0125    ...             0           0          0   \n",
      "123  49.3907   0.0000  0.0037    ...             0           0          0   \n",
      "\n",
      "     model_4S店  model_一级代理商 model_二级及二级以下代理商  model_其它  model_多品牌经营店  \\\n",
      "0            1            0                0         0             0   \n",
      "1            1            0                0         0             0   \n",
      "2            1            0                0         0             0   \n",
      "3            0            1                0         0             0   \n",
      "4            1            0                0         0             0   \n",
      "5            1            0                0         0             0   \n",
      "6            1            0                0         0             0   \n",
      "7            0            1                0         0             0   \n",
      "8            0            0                1         0             0   \n",
      "9            0            0                1         0             0   \n",
      "10           1            0                0         0             0   \n",
      "11           1            0                0         0             0   \n",
      "12           1            0                0         0             0   \n",
      "13           1            0                0         0             0   \n",
      "14           1            0                0         0             0   \n",
      "15           1            0                0         0             0   \n",
      "16           1            0                0         0             0   \n",
      "17           1            0                0         0             0   \n",
      "18           1            0                0         0             0   \n",
      "19           1            0                0         0             0   \n",
      "20           1            0                0         0             0   \n",
      "21           1            0                0         0             0   \n",
      "22           0            0                0         1             0   \n",
      "23           0            0                0         1             0   \n",
      "24           0            1                0         0             0   \n",
      "25           0            1                0         0             0   \n",
      "26           0            1                0         0             0   \n",
      "27           1            0                0         0             0   \n",
      "28           1            0                0         0             0   \n",
      "29           1            0                0         0             0   \n",
      "..         ...          ...              ...       ...           ...   \n",
      "94           1            0                0         0             0   \n",
      "95           0            0                0         1             0   \n",
      "96           0            0                1         0             0   \n",
      "97           1            0                0         0             0   \n",
      "98           1            0                0         0             0   \n",
      "99           1            0                0         0             0   \n",
      "100          1            0                0         0             0   \n",
      "101          0            0                1         0             0   \n",
      "102          0            1                0         0             0   \n",
      "103          1            0                0         0             0   \n",
      "104          1            0                0         0             0   \n",
      "105          0            1                0         0             0   \n",
      "106          0            1                0         0             0   \n",
      "107          1            0                0         0             0   \n",
      "108          1            0                0         0             0   \n",
      "109          0            0                1         0             0   \n",
      "110          0            1                0         0             0   \n",
      "111          0            0                1         0             0   \n",
      "112          0            0                1         0             0   \n",
      "113          1            0                0         0             0   \n",
      "114          0            1                0         0             0   \n",
      "115          1            0                0         0             0   \n",
      "116          1            0                0         0             0   \n",
      "117          0            1                0         0             0   \n",
      "118          0            1                0         0             0   \n",
      "119          1            0                0         0             0   \n",
      "120          0            1                0         0             0   \n",
      "121          0            0                0         1             0   \n",
      "122          1            0                0         0             0   \n",
      "123          1            0                0         0             0   \n",
      "\n",
      "     result_异常  result_正常  \n",
      "0            0          1  \n",
      "1            0          1  \n",
      "2            0          1  \n",
      "3            1          0  \n",
      "4            0          1  \n",
      "5            0          1  \n",
      "6            0          1  \n",
      "7            1          0  \n",
      "8            1          0  \n",
      "9            0          1  \n",
      "10           0          1  \n",
      "11           0          1  \n",
      "12           0          1  \n",
      "13           0          1  \n",
      "14           0          1  \n",
      "15           0          1  \n",
      "16           0          1  \n",
      "17           0          1  \n",
      "18           0          1  \n",
      "19           1          0  \n",
      "20           1          0  \n",
      "21           1          0  \n",
      "22           1          0  \n",
      "23           0          1  \n",
      "24           1          0  \n",
      "25           1          0  \n",
      "26           1          0  \n",
      "27           0          1  \n",
      "28           0          1  \n",
      "29           0          1  \n",
      "..         ...        ...  \n",
      "94           0          1  \n",
      "95           0          1  \n",
      "96           0          1  \n",
      "97           1          0  \n",
      "98           0          1  \n",
      "99           0          1  \n",
      "100          1          0  \n",
      "101          1          0  \n",
      "102          0          1  \n",
      "103          0          1  \n",
      "104          1          0  \n",
      "105          1          0  \n",
      "106          0          1  \n",
      "107          0          1  \n",
      "108          0          1  \n",
      "109          1          0  \n",
      "110          0          1  \n",
      "111          1          0  \n",
      "112          1          0  \n",
      "113          1          0  \n",
      "114          0          1  \n",
      "115          1          0  \n",
      "116          1          0  \n",
      "117          1          0  \n",
      "118          1          0  \n",
      "119          1          0  \n",
      "120          1          0  \n",
      "121          1          0  \n",
      "122          0          1  \n",
      "123          1          0  \n",
      "\n",
      "[124 rows x 31 columns]\n"
     ]
    }
   ],
   "source": [
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.drop([u'销售类型',u'销售模式',u'输出'],axis=1,inplace = True)\n",
    "#正常列去除，异常列作为结果 1表示异常 0表示正常\n",
    "df.drop([u'result_正常'],axis=1,inplace=True)\n",
    "df.rename(columns={u'result_异常':'result'},inplace = True)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     纳税人编号  汽车销售平均毛利    维修毛利  企业维修收入占销售收入比重   增值税税负    存货周转率  成本费用利润率  整体理论税负  \\\n",
      "0        1    0.0635  0.3241         0.0879  0.0084   8.5241   0.0018  0.0166   \n",
      "1        2    0.0520  0.2577         0.1394  0.0298   5.2782  -0.0013  0.0032   \n",
      "2        3    0.0173  0.1965         0.1025  0.0067  19.8356   0.0014  0.0080   \n",
      "3        4    0.0501  0.0000         0.0000  0.0000   1.0673  -0.3596 -0.1673   \n",
      "4        5    0.0564  0.0034         0.0066  0.0017  12.8470  -0.0014  0.0123   \n",
      "5        6    0.0484  0.6814         0.0064  0.0031  15.2445   0.0012  0.0063   \n",
      "6        7    0.0520  0.3868         0.0348  0.0054  16.8715   0.0054  0.0103   \n",
      "7        8   -1.0646  0.0000         0.0000  0.0770   2.0000  -0.2905 -0.1810   \n",
      "8        9    0.0341 -1.2062         0.0025  0.0070   9.6142  -0.1295  0.0413   \n",
      "9       10    0.0312  0.2364         0.0406  0.0081  21.3944   0.0092  0.0112   \n",
      "10      11    0.0489  0.4763         0.0851  0.0000  10.9974   0.2156  0.0136   \n",
      "11      12    0.0638  0.4570         0.1521  0.0175   3.5134   0.1022  0.0239   \n",
      "12      13    0.0250  0.5117         0.0332  0.0107  18.3744   0.5642  0.0071   \n",
      "13      14    0.0354  0.3237         0.0505  0.0000   8.1862  -0.0001  0.0002   \n",
      "14      15    0.0204  0.4578         0.0568  0.0000   9.8039   0.0002  0.0046   \n",
      "15      16    0.0578  0.4547         0.0677  0.0150  11.4036   0.0014  0.0118   \n",
      "16      17    0.0614  0.5868         0.0080  0.0030  11.9058   0.0000  0.0184   \n",
      "17      18    0.0546  0.4269         0.0420  0.0055   6.4187   1.0940 -0.0044   \n",
      "18      19    0.0323  0.4132         0.0352  0.0047  11.0045   1.2121  0.0188   \n",
      "19      20    0.0587  0.3284         0.0212  0.0000  21.3226   1.5312  0.0120   \n",
      "20      21    0.0440  0.4071         0.0181  0.0079  18.4517   0.9134  0.0258   \n",
      "21      22    0.0555  0.0000         0.0000  0.0056  22.4516   0.9252  0.0087   \n",
      "22      23    0.0060  0.0000         0.0000  0.0000   0.0000   0.0060  0.0009   \n",
      "23      24    0.0185  0.0000         0.0000  0.0040   0.0000   0.0185  0.0040   \n",
      "24      25    0.0115  0.0000         0.0000  0.0028  47.6128   0.0004  0.0042   \n",
      "25      26    0.0091  0.0000         0.0000  0.0028  40.0488   0.0004 -0.0012   \n",
      "26      27    0.0115  0.0000         0.0000  0.0027  48.3830   0.0003  0.0053   \n",
      "27      28   -0.0047  0.2811         0.1362  0.0089  12.0948  -0.0074 -0.0081   \n",
      "28      29    0.0066  0.2784         0.1301  0.0064  26.9379  -0.0046  0.0085   \n",
      "29      30    0.0073  0.2705         0.1473  0.0073  20.6979  -0.0117  0.0091   \n",
      "..     ...       ...     ...            ...     ...      ...      ...     ...   \n",
      "94      95    0.0299  0.2824         0.0747  0.0047   8.6046   0.0201 -0.0005   \n",
      "95      96    0.0000  0.0000         0.0000  0.0107  21.2676   0.2904  0.0123   \n",
      "96      97    0.0235  0.0000         0.0000  0.0026  12.0229  -0.0025  0.0200   \n",
      "97      98    0.0469  0.4438         0.0921  0.0064  19.8277   0.0182  0.0106   \n",
      "98      99    0.0404  0.2879         0.1408  0.0113   5.8424  -0.0153  0.0178   \n",
      "99     100    0.0238  0.0000         0.0000  0.0000   8.4731  -0.0129  0.0024   \n",
      "100    101    0.0212  0.0000         0.0000  0.0000   0.0000  -0.0106  0.0000   \n",
      "101    102    0.0109  0.0000         0.0000  0.0030   0.0000   0.0041  0.0030   \n",
      "102    103    0.0301  0.1325         0.0760  0.0053   7.3614   0.0005  0.0129   \n",
      "103    104    0.0120  0.4424         0.1393  0.0088   9.7004   1.0270  0.0120   \n",
      "104    105    0.0000  0.0000         0.0000  0.0000   3.3748  -0.1933  0.0670   \n",
      "105    106    0.0000  0.0000         0.0000  0.0000   0.0000   0.0000  0.0000   \n",
      "106    107    0.0172  0.2492         0.0340  0.0015  11.5771   0.0049  0.0048   \n",
      "107    108    0.0539  0.2598         0.0463  0.0096  26.1375   0.1030  0.0120   \n",
      "108    109    0.0471  0.4431         0.0778  0.0086  21.3278   0.0027  0.0115   \n",
      "109    110    0.0129  0.0000         0.0000  0.0073   0.0000  -0.0036  0.0073   \n",
      "110    111    0.0283  0.0000         0.0000  0.0017  12.4257   0.0007  0.0049   \n",
      "111    112    0.0000  0.0000         0.0000  0.0000   0.0000   0.0000  0.0000   \n",
      "112    113    0.0000  0.0000         0.0000  0.0000   0.0000   0.0000  0.0000   \n",
      "113    114    0.0494  0.0000         0.0000  0.0044   6.4030   0.0328 -0.0229   \n",
      "114    115    0.0494  0.0815         0.0000  0.0000   0.0182   6.9651 -0.0050   \n",
      "115    116    0.0000  0.0000         0.0000  0.0000   0.0000   0.0000  0.0000   \n",
      "116    117    0.0000  0.0000         0.0000  0.0263   3.3587  -0.0772  0.1078   \n",
      "117    118    0.0640  0.0000         0.0000  0.0050  19.0593   0.0394  0.0008   \n",
      "118    119    0.0713  0.0000         0.0000  0.0080  32.2678   0.0036  0.0106   \n",
      "119    120    0.0000  0.0000         0.0000  0.0000   0.0000   0.0000  0.0000   \n",
      "120    121    0.0196  0.0000         0.0000  0.0015   0.0000   0.0020  0.0176   \n",
      "121    122    0.0000  0.0000         0.0000  0.0000   6.1714   0.0000  0.0303   \n",
      "122    123    0.0458  0.2942         0.0665  0.0108  11.8587   0.0014  0.0125   \n",
      "123    124    0.0135  0.4799         0.0094  0.0041  49.3907   0.0000  0.0037   \n",
      "\n",
      "     整体税负控制数     办牌率   ...    type_大客车  type_工程车  type_微型面包车  type_进口轿车  \\\n",
      "0     0.0147  0.4000   ...           0         0           0          0   \n",
      "1     0.0137  0.3307   ...           0         0           0          0   \n",
      "2     0.0061  0.2256   ...           0         0           0          0   \n",
      "3     0.0000  0.0000   ...           0         0           0          0   \n",
      "4     0.0095  0.0039   ...           0         0           0          1   \n",
      "5     0.0089  0.1837   ...           0         0           0          1   \n",
      "6     0.0108  0.2456   ...           0         0           0          1   \n",
      "7     0.0000  0.0000   ...           1         0           0          0   \n",
      "8     0.0053  0.7485   ...           0         0           0          0   \n",
      "9     0.0067  0.6621   ...           0         0           0          0   \n",
      "10    0.0145  0.0000   ...           0         0           0          0   \n",
      "11    0.0210  0.0000   ...           0         0           0          0   \n",
      "12    0.0070  0.0000   ...           0         0           0          0   \n",
      "13    0.0085  0.0000   ...           0         0           0          0   \n",
      "14    0.0077  0.0000   ...           0         0           0          0   \n",
      "15    0.0144  0.0000   ...           0         0           0          0   \n",
      "16    0.0112  0.0000   ...           0         0           0          0   \n",
      "17    0.0119  0.0000   ...           0         0           0          0   \n",
      "18    0.0078  0.0000   ...           0         0           0          0   \n",
      "19    0.0110  0.0000   ...           0         0           0          0   \n",
      "20    0.0086  0.8775   ...           0         0           0          0   \n",
      "21    0.0000  0.7137   ...           0         0           0          0   \n",
      "22    0.0000  0.0000   ...           0         0           0          0   \n",
      "23    0.0000  0.0000   ...           0         0           0          0   \n",
      "24    0.0000  0.0000   ...           1         0           0          0   \n",
      "25    0.0000  0.0000   ...           1         0           0          0   \n",
      "26    0.0000  0.0000   ...           1         0           0          0   \n",
      "27    0.0058  0.4269   ...           0         0           0          0   \n",
      "28    0.0071  0.4478   ...           0         0           0          0   \n",
      "29    0.0078  0.6214   ...           0         0           0          0   \n",
      "..       ...     ...   ...         ...       ...         ...        ...   \n",
      "94    0.0074  0.0000   ...           0         0           0          0   \n",
      "95    0.0000  0.0000   ...           1         0           0          0   \n",
      "96    0.0000  0.0000   ...           0         0           0          0   \n",
      "97    0.0126  0.3771   ...           0         0           0          0   \n",
      "98    0.0117  0.2784   ...           0         0           0          0   \n",
      "99    0.0025  0.0000   ...           0         0           0          0   \n",
      "100   0.0000  0.0000   ...           0         0           0          0   \n",
      "101   0.0000  0.0000   ...           1         0           0          0   \n",
      "102   0.0038  0.0000   ...           0         0           0          0   \n",
      "103   0.0148  0.0000   ...           0         0           0          0   \n",
      "104   0.0000  0.0000   ...           0         0           0          1   \n",
      "105   0.0000  0.0000   ...           0         0           1          0   \n",
      "106   0.0045  0.0000   ...           0         1           0          0   \n",
      "107   0.0121  0.1556   ...           0         0           0          0   \n",
      "108   0.0083  0.3321   ...           0         0           0          0   \n",
      "109   0.0000  0.0000   ...           0         0           0          0   \n",
      "110   0.0059  0.0703   ...           0         0           0          0   \n",
      "111   0.0000  0.0000   ...           1         0           0          0   \n",
      "112   0.0000  0.0000   ...           0         0           0          0   \n",
      "113   0.0000  0.0000   ...           0         0           0          1   \n",
      "114   0.0570  0.0139   ...           0         0           0          0   \n",
      "115   0.0000  0.0000   ...           0         0           1          0   \n",
      "116   0.0000  0.0000   ...           0         0           0          0   \n",
      "117   0.0000  0.0000   ...           0         0           0          0   \n",
      "118   0.0000  0.7173   ...           0         0           0          0   \n",
      "119   0.0000  0.0000   ...           0         0           0          0   \n",
      "120   0.0000  0.0000   ...           0         0           0          0   \n",
      "121   0.0000  0.0000   ...           0         0           0          0   \n",
      "122   0.0129  0.0000   ...           0         0           0          0   \n",
      "123   0.0021  0.0000   ...           0         0           0          0   \n",
      "\n",
      "     model_4S店  model_一级代理商  model_二级及二级以下代理商  model_其它  model_多品牌经营店  result  \n",
      "0            1            0                 0         0             0       0  \n",
      "1            1            0                 0         0             0       0  \n",
      "2            1            0                 0         0             0       0  \n",
      "3            0            1                 0         0             0       1  \n",
      "4            1            0                 0         0             0       0  \n",
      "5            1            0                 0         0             0       0  \n",
      "6            1            0                 0         0             0       0  \n",
      "7            0            1                 0         0             0       1  \n",
      "8            0            0                 1         0             0       1  \n",
      "9            0            0                 1         0             0       0  \n",
      "10           1            0                 0         0             0       0  \n",
      "11           1            0                 0         0             0       0  \n",
      "12           1            0                 0         0             0       0  \n",
      "13           1            0                 0         0             0       0  \n",
      "14           1            0                 0         0             0       0  \n",
      "15           1            0                 0         0             0       0  \n",
      "16           1            0                 0         0             0       0  \n",
      "17           1            0                 0         0             0       0  \n",
      "18           1            0                 0         0             0       0  \n",
      "19           1            0                 0         0             0       1  \n",
      "20           1            0                 0         0             0       1  \n",
      "21           1            0                 0         0             0       1  \n",
      "22           0            0                 0         1             0       1  \n",
      "23           0            0                 0         1             0       0  \n",
      "24           0            1                 0         0             0       1  \n",
      "25           0            1                 0         0             0       1  \n",
      "26           0            1                 0         0             0       1  \n",
      "27           1            0                 0         0             0       0  \n",
      "28           1            0                 0         0             0       0  \n",
      "29           1            0                 0         0             0       0  \n",
      "..         ...          ...               ...       ...           ...     ...  \n",
      "94           1            0                 0         0             0       0  \n",
      "95           0            0                 0         1             0       0  \n",
      "96           0            0                 1         0             0       0  \n",
      "97           1            0                 0         0             0       1  \n",
      "98           1            0                 0         0             0       0  \n",
      "99           1            0                 0         0             0       0  \n",
      "100          1            0                 0         0             0       1  \n",
      "101          0            0                 1         0             0       1  \n",
      "102          0            1                 0         0             0       0  \n",
      "103          1            0                 0         0             0       0  \n",
      "104          1            0                 0         0             0       1  \n",
      "105          0            1                 0         0             0       1  \n",
      "106          0            1                 0         0             0       0  \n",
      "107          1            0                 0         0             0       0  \n",
      "108          1            0                 0         0             0       0  \n",
      "109          0            0                 1         0             0       1  \n",
      "110          0            1                 0         0             0       0  \n",
      "111          0            0                 1         0             0       1  \n",
      "112          0            0                 1         0             0       1  \n",
      "113          1            0                 0         0             0       1  \n",
      "114          0            1                 0         0             0       0  \n",
      "115          1            0                 0         0             0       1  \n",
      "116          1            0                 0         0             0       1  \n",
      "117          0            1                 0         0             0       1  \n",
      "118          0            1                 0         0             0       1  \n",
      "119          1            0                 0         0             0       1  \n",
      "120          0            1                 0         0             0       1  \n",
      "121          0            0                 0         1             0       1  \n",
      "122          1            0                 0         0             0       0  \n",
      "123          1            0                 0         0             0       1  \n",
      "\n",
      "[124 rows x 27 columns]\n"
     ]
    }
   ],
   "source": [
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "data=df.values\n",
    "from random import shuffle\n",
    "shuffle(data)\n",
    "data_train=data[:int(len(data)*0.8),:]\n",
    "data_test=data[int(len(data)*0.8):,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQYAAAD3CAYAAAD/jPo0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAFyBJREFUeJzt3XuYHXV9x/H3Z3cTwi3FGK67wYQQkJhKSMKlovWC8oSb0D5CwapQUSrWC01VsNpW2/qUPt5qK9WmiqhtuWqepmiBlBa5PIAkAQUMlxCD2WxICCAgt5DNt3/MLDm7Z7NndjNzZs6ez4tnnj0z5+zMdzfkm9/vN/P7fRURmJnV6ig7ADOrHicGM6vjxGBmdZwYzKyOE4OZ1XFiMLM6TgxmVseJwczqODGYWR0nBjOr01V2AGbtTFMnBVu2Zfvwsy9fHxELi40o4cRgVqYt2+CYfbN9dlnv1GKD2c6JwaxMopIdeicGs7JJZUdQx4nBrFSCjuolhgo2YlqDpIWSHpS0WtJ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JcYAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 288x288 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQYAAAD3CAYAAAD/jPo0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAFjxJREFUeJzt3XmYXXV9x/H3ZyaOAVlEghCSCFEhECNLwlZABcPqBvpoJQrFygOFPuLW1mKxpba10tJqpdLHIiBtVZCqKFUKIloUBGQNECOrBAbCksYqm2T79o9zBm9muffcO+fc35l7Py+e8zD3zLm/852b5Du/7fx+igjMzBoNpA7AzOrHicHMxnBiMLMxnBjMbAwnBjMbw4nBzMZwYjDrIZIukPSEpLtGnT9V0t2Slkn6+1blODGY9ZYLgSMaT0g6GDgK2C0iXgP8Q6tCnBjMekhE/AhYPer0KcCZEfF8fs0TrcpxYjDrfTsDr5N0o6RrJO3d6g3TuhCUmU1AM6YHazYUu/iptcuA3zScOTcizi3wzmnAVsB+wN7AJZJeGU2eh3BiMEtpzQbYb9ti1141/JuI2KuDuwwD38wTwU8lbQBmAE9O9AY3JcxSEtm/wiJH574FvBFA0s7AELCq2RtcYzBLTSqxKF0EHATMkDQMnAFcAFyQD2GuAY5v1owAJwazxAQD5SWGiFgywbeObaccJwazlEaaEjVTw5CmBklH5DPJ7pN0Wup4es1EM/h6klTs6CInhg5IGgTOAY4E5gNLJM1PG1XPuZBRM/h6lgoeXeTE0Jl9gPsi4oGIWANcTDbl1EoywQy+3iOyPoYiRxc5MXRmFvBww+vh/JxZ+2pYY3DnY2fG+2PyqrrWmS73HxThxNCZYWBOw+vZwKOJYrGpTMBg/RKDmxKduQnYSdJcSUPAMcBliWOyqaqGTQknhg5ExDrgA8CVwHLgkohYljaq3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n+jVuzPpMmfMY8udr7pZ0X7MncFtxYjBLrpzUIGkQOIfsuZz5wBJJ8zuJyInBLCWVuh7DPsB9EfFARKwBLgaO6iQsJwazhEp+unIW8HDD6+H8XNvc+WiW0K233HblJtNeMqPg5dPVfO/K8bJHR1ObnRjMEoqII0osbhiY0/B6NvBoJwW5KWHWO24CdpI0V9IQ2SI8RdbYGMM1BrMeERHrJH2A7FH3QeCCiFjWSVl+utLMxnBTwszGcGIwszGcGMxsDCcGMxvDicHMxnBiMLMxnBjMbAwnBjMb4/8BCzYt8w/xIUMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 288x288 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.         0.05423611 0.15523026 0.         0.         0.14788889\n",
      " 0.         0.64264474 0.         0.         0.         0.\n",
      " 0.         0.         0.         0.         0.         0.\n",
      " 0.         0.         0.         0.         0.         0.\n",
      " 0.        ] Index(['纳税人编号', '汽车销售平均毛利', '维修毛利', '企业维修收入占销售收入比重', '增值税税负', '存货周转率',\n",
      "       '成本费用利润率', '整体理论税负', '整体税负控制数', '办牌率', '单台办牌手续费收入', '代办保险率', '保费返还率',\n",
      "       'type_其它', 'type_卡车及轻卡', 'type_商用货车', 'type_国产轿车', 'type_大客车',\n",
      "       'type_工程车', 'type_微型面包车', 'type_进口轿车', 'model_4S店', 'model_一级代理商',\n",
      "       'model_二级及二级以下代理商', 'model_其它', 'model_多品牌经营店', 'result'],\n",
      "      dtype='object')\n",
      "76.000000%\n"
     ]
    }
   ],
   "source": [
    "#确定y值和特征值\n",
    "y=data_train[:,-1]\n",
    "x=data_train[:,1:-1]\n",
    "from sklearn.tree import DecisionTreeClassifier #导入决策树模型\n",
    "\n",
    "\n",
    "tree = DecisionTreeClassifier() #建立决策树模型\n",
    "tree.fit(x, y) #训练\n",
    "\n",
    "#保存模型\n",
    "#from sklearn.externals import joblib\n",
    "#joblib.dump(tree, 'C:/Python27/Lib/site-packages/xy/chapter6/thoughts_tree.pkl')\n",
    "\n",
    "from cm_plot import * #导入混淆矩阵可视化函数\n",
    "cm_plot(y, tree.predict(x)).show() #显示混淆矩阵可视化结果\n",
    "\n",
    "cm_plot(data_test[:,-1],tree.predict(data_test[:,1:-1])).show()\n",
    "print(tree.feature_importances_,df.columns)\n",
    "print('%f%%'%(tree.score(data_test[:,:-2],data_test[:,-1])*100))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQYAAAD3CAYAAAD/jPo0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAFx1JREFUeJzt3XucHWV9x/HPdzcJgRAEEhJICCRACOTFS3LhooYiCqTBUlErCHgBQUBarRZrwdZaUam0tvVSqDZVBFoEUiCvIrc0UrkKShKggAFCKDEhkRiuMQFy+/WPmTVn92z2zG5mzpzL981rXntmztmZ3y7JL8/zzDzPTxGBmVmljrIDMLPG48RgZlWcGMysihODmVVxYjCzKk4MZlbFicHMqjgxmFkVJwYzq+LEYGZVBpUdgFk708ihwYYt2T68duO8iJhVbEQJJwazMm3YAm8bne2z81eMLDaYrZwYzMokGrJD78RgVjap7AiqODGYlUrQ0XiJoQEbMc1B0ixJT0l6RtJFZcfTaiRdIWm1pMfLjqVQXV2JLFsdOTEMgKRO4HLgBGAycJqkyeVG1XKuBOoyAl86KdtWR04MA3ME8ExEPBsRG4DrgJNKjqmlRMQ9wEtlx1EXyrjVkRPDwIwFllfsr0iPmfWPSMYYsmx15MHHgent/5IXz7SBabyxRyeGAVoBjKvY3xtYWVIs1uwa8HaluxID8xAwUdIESUOAU4GbS47JmpGATmXbap1KmiTpkYrtNUmflbS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SvkbSXdkZmFfx3pyI2AIskfRs+jPMBN5aMf7wlvTaT2e4Vlvwcwzt5/WImFJ5IP1DsK7yEDC/5+QXSVOAyCkOAV+PiH/tcY3PDuAaVwLvi4hHJZ0JHFPxXs9zRXrtT0dEZQJB0vh+XreFNV5icFeifA8CMyQdACBpJ0kHAk8CEyTtn35uW7Pm7gTOT7+3U9IuwFqS1kCXecBZFWMXY9Plve4B3i9pR0nDSbottQwHVkkaDHy4x3snS+pIY94PeCq99vnp55F0oKRhGa7TNvKcdp0XtxhKFhG/Sf/lvVbSDunhL0bE05LOBW6VtAa4Dzikl1N8BpidzrvfDJwfEQ9Iuj+9HXh7Os5wMPBA2mL5LfCRiFgk6XrgEWAZSXenlr8Gfp5+/jG6J6CngLuB0cAnI+INSd8nGXtYpOTivyHDYqTtpfFaDIrIq7VqZv01dfrUuPvB/8n02bcM2X1hveaNuCthZlXclTArUTJ+0Hj/PjsxmJWs8UYYnBjMSufnGMysh8ZcwanxOjdmbSbn5eNnpXNfnulrBm4tTgxmpcsnNUjqBC4nmZczGThN0uSBROTEYFYm5boewxHAMxHxbERsAK4jqXTdb04MZiXKeXblWGB5xf6K9Fi/efDRrESLFj48b8dBw0Zm/PhQ9V3turfsMaBHm50YzEoUEbNyPN0KYFzF/t7AyoGcyF0Js9bxEDBR0gRJQ0gW4cmyxkYVtxjMWkREbJL0KZKp7p3AFRHxxEDO5dmVZlbFXQkzq+LEYGZVnBjMrIoTg5lVcWIwsypODGZWxYnBzKo4MZhZlf8He1Xgv56red8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 288x288 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQYAAAD0CAYAAAB5GIiaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCB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ZXQg0HZgO7Ao9ExIMAkn4E9Fd0fAfwIYCIWA28IGnzPuccnm935/ujyRLFJsCVEfFSfo+rCvxMe0j6N7LHldHAdTXvXRERa4AHJT2c/wyHA2+uqX/YNL/3ogL36gqtqnxUdqFLgIUR8fUNuZYTQ7lejoi9ag/k/wiW1x4CZkXECX3O2wuIFsUh4CsR8f0+9/hEE/eYARwdEfdIOgk4pOa9vteK/N5nRERtAln7DGxAC7tEHwR8ELi35g/S5yPi6kYv5EeJ9OYAB0naEUDSSEk7A/cDEyXtkJ93wno+fwNwev7ZXkljgBfJSgNrXQecXFN3MU7SlsDNwDGSXpc3b72nQLybAE/lRdZ/7PPecZJ68pi3Bx7I7316fj6SdpY0qsB9ukar+jFExK0RoYh4c/4YuVczSQFcYkguIp7J//LOlLRxfvgLEbEor3X+taSlwK3AHv1c4kxguqRTgNXA6RExW9JteXPgNXk9w27A7LzE8jfgxLy9+yfAPOBRssedwfwLWU33o2R1JrUJ6AHgJmAr4KMR8Yqki8nqHu7Ki7rPAEcX+3a6QTWndlNEq0qrZtaovffZO26a89tC5246fIs72zVuxCUGs4SyFofqlRicGMySc2Iwsz6qlxacGMySq2LloxODWVLFmiLbzYnBLDknBjOrVdE5H93z0czquIOTWUKSriWbCbuIpRExtcx41nJiMLM6fpQwszpODGZWx4nBzOo4MZhZHScGM6vjxGBmdZwYzKyOE4OZ1XFiMLM6/wcg4fjQT+JEqgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 288x288 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "68.000000%\n",
      "             columns                     coef\n",
      "0              纳税人编号    [-0.2237772843310435]\n",
      "1           汽车销售平均毛利    [-0.5507319889868789]\n",
      "2               维修毛利    [-0.6556170112054793]\n",
      "3      企业维修收入占销售收入比重   [-0.05791511067463849]\n",
      "4              增值税税负     [0.0069495062011575]\n",
      "5              存货周转率    [0.23112082574625348]\n",
      "6            成本费用利润率  [-0.012246755096687652]\n",
      "7             整体理论税负   [-0.06371110541826597]\n",
      "8            整体税负控制数     [1.1250987009806337]\n",
      "9                办牌率    [0.35513882163878635]\n",
      "10         单台办牌手续费收入    [-0.6884098060281778]\n",
      "11             代办保险率    [-0.5685037119645966]\n",
      "12             保费返还率   [-0.03262091148923078]\n",
      "13           type_其它    [-0.4296119707142529]\n",
      "14        type_卡车及轻卡                    [0.0]\n",
      "15         type_商用货车   [-0.11124004684293501]\n",
      "16         type_国产轿车     [0.2959408902447127]\n",
      "17          type_大客车     [0.6340716589105818]\n",
      "18          type_工程车    [-0.2040150842314393]\n",
      "19        type_微型面包车   [-0.15252453587744763]\n",
      "20         type_进口轿车    [-0.3690252571047527]\n",
      "21         model_4S店     [0.6863458651826071]\n",
      "22       model_一级代理商    [-0.7838295944503605]\n",
      "23  model_二级及二级以下代理商     [0.6413415268610023]\n",
      "24          model_其它   [-0.17483254048848446]\n"
     ]
    }
   ],
   "source": [
    "#逻辑回归\n",
    "from sklearn import linear_model\n",
    "#clf=linear_model.LogisticRegression(C=1.0,penalty='l1',tol=1e-6)\n",
    "clf=linear_model.RidgeClassifier()\n",
    "#此处的x,y与上文中决策树所用x,y相同\n",
    "clf.fit(x,y)\n",
    "#逻辑回归系数\n",
    "xishu=pd.DataFrame({\"columns\":list(df.columns)[:-2], \"coef\":list(clf.coef_.T)})\n",
    "#逻辑回归混淆矩阵\n",
    "cm_plot(y,clf.predict(x)).show()\n",
    "#对test数据进行预测\n",
    "predictions=clf.predict(data_test[:,1:-1])\n",
    "#test混淆矩阵\n",
    "cm_plot(data_test[:,-1],predictions).show()\n",
    "test_acc = clf.score(data_test[:,:-2],data_test[:,-1])*100\n",
    "print('%f%%'%test_acc)\n",
    "print(xishu)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAA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XU1LVq04NFHH93vNSUlJQwaNIjBgwdz+umns2LFCtatW0dZWRllZWUceeSRdOvWrfb5zp07G/Orqlfenio3b4bnngsejxsXbSwiEr7WrVtTWVnJ3Llz6dSpEw899BAA27ZtY/jw4dx8880sWrSIjz/+mHfeeYeHH34YgLlz53L99dfz1FNPsWDBAubOnUuvXr3S/tyPPvqIXbt2UVlZyciRI/fb98gjj/Dqq6/y/vvvM3fuXGbNmrVfMnrmmWc4+eSTmZxifeCZM2cye/ZszjjjDO688046d+5MZWUllZWVfP/73+fHP/5x7fOWLVseyK8spbxNCs8+C1u3wmmnQSP+viKSB0455RRWrVoFwKRJkzj11FM599xzAWjTpg0PPvggd999NwD33HMPt956K/369QOgefPm/OAHP0h6z/Xr13PJJZcwePBgTj75ZGbPns3atWu56qqrqKyspKysjKVLl+73mrvuuouHH36YDh06ANCxY0e+EzfBOXnyZO677z6qqqpq463vWDIhb5OC7k0QiYZZOP/StWfPHl5//XWGDw+ubp83bx4nnnjifm169+7NV199xaZNm5g7d27S/lRuv/12jj/+eGbPns1dd93FuHHjOPzww3nsscc47bTTqKyspHfv3rXtN2/ezObNm/fbFm/lypX84x//YOjQoYwYMSLl0BPAn//8Zy655JJ0D/+g5WVS+PRT+OtfoXXr4FJUEcl/27Zto6ysjM6dO7N+/XrOOeccILhMs67J18ZMyr711luMHTsWgDPPPJN169axcePGOtvX97kAU6ZMYcSIEQCMGjUqaQhp2LBhHH744bz22mtceeWVacd5sPIyKdRchnrppRDrtYlIhriH868hNXMKK1asYOfOnbVzCgMHDqSiomK/tsuWLaNdu3a0b9+egQMH8uGHH6ZxXMlB1HfS79ChA23btmXZsmUp90+ePJkJEyZQUlLC8OHD+fjjj1m8eHHt/pkzZ7JixQoGDhzIbbfdlvI9wpB3ScEdaib3NXQkUng6duzIAw88wL333suuXbsYM2YMb731Fq+99hoQ9ChuuOEGfvaznwHw05/+lLvuuotFixYBsHfvXn77298mve83vvENno4tyvLGG2/QpUuX2rmCutxyyy388Ic/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moddzQ0R9i29YC57j7CcBI4IEUr/s+8Dt3LyM4KVfFyiCMBE6Nbd8DjGng8y8C5phZK2ACMNLdBxFUALjOzDoBlwID3X0wcGf8i939WaCC4Bt9mbtvi9v9LHBZ3PORwNQDjPM8gpIXNW5193JgMHC6mQ129wcIauMMc/dhsbIYvwDOjv0uK4AbG/gcKSBZWeZCCt622IkxXgvgwdgY+h6Cej+J/gbcambFwHPuvtjMzgJOBD6IlQNpTZBgUnnazLYBywnKMR8HfOrui2L7nwB+CDxIsI7DY2b2JyDtEt7uXm1my2J1axbHPuPt2Ps2Js62BGUg4lfeGmFm1xL8f30UwQI0sxNee3Js+9uxz2lJ8HsTAZQUJHf8GFgDDCHo4SYtruPuk8zsPeBC4GUz+1eCUsNPuPstaXzGmPjCemaWcn2OWH2eoQRF2UYB1wNnNuJYpgIjgE+AP7i7W3CGTjtOghXJ7gYeAi4zs57AT4CT3H2DmU0gKBSXyIBX3X10I+KVAqLhI8kVHYHVsZr5Ywm+Je/HzHoBy2JDJtMJhlFeB64ws8NjbTpZ+utZfwKUmNmxsedjgb/GxuA7uvsMgkncVFcAbSYo853Kc8AlBOsCTI1ta1Sc7r6LYBjo5NjQUwdgC7DRzI4Azq8jlneBU2uOyczamFmqXpcUKCUFyRUPA98xs3cJho62pGgzEphrZpVAP4JlC+cTnDxfMbPZwKsEQysNcvftBFUonzGzOcBe4BGCE+yLsff7K0EvJtEE4JGaieaE990AzAeOcff3Y9saHWdsruI+4Cfu/jHBus3zgMcJhqRqjAdeMrOZ7l5NcGXU5NjnvEvwuxIBVCVVRETiqKcgIiK1lBRERKSWkoKIiNRSUhARkVpKCiIiUktJQUREaikpiIhILSUFERGp9f8BaoGG7SaDLNkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#两个分类方法的ROC曲线\n",
    "from sklearn.metrics import roc_curve #导入ROC曲线函数\n",
    "import matplotlib.pyplot as plt\n",
    "fig,ax=plt.subplots()\n",
    "fpr, tpr, thresholds = roc_curve(data_test[:,-1], tree.predict_proba(data_test[:,1:-1])[:,1], pos_label=1)\n",
    "fpr2, tpr2, thresholds2 = roc_curve(data_test[:,-1], clf.predict_proba(data_test[:,1:-1])[:,1], pos_label=1)\n",
    "plt.plot(fpr, tpr, linewidth=2, label = 'ROC of CART', color = 'blue') #作出ROC曲线\n",
    "plt.plot(fpr2, tpr2, linewidth=2, label = 'ROC of LR', color = 'green') #作出ROC曲线\n",
    "plt.xlabel('False Positive Rate') #坐标轴标签\n",
    "plt.ylabel('True Positive Rate') #坐标轴标签\n",
    "plt.ylim(0,1.05) #边界范围\n",
    "plt.xlim(0,1.05) #边界范围\n",
    "plt.legend(loc=4) #图例\n",
    "plt.show() #显示作图结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
